import jwt from 'jsonwebtoken';
import {login} from './user/core';

//adm:3e67cc5df64c81a0dd4ec40d7feaede8 TuqGbN

module.exports = (r, app) => {
    const secret = app.secret || 'secret';
    r.post('/', ctx =>
        login(ctx.req.body).then(user => {
            ctx.body = jwt.sign(user, secret);
        })
    );

    return true;
};
